home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 - Homepage / CHIP.BIN / share / webmaste / csehtmlp / csehtmlp.exe / {app} / ParserRules / xml_with_scripts.xs < prev    next >
Encoding:
Text File  |  2002-04-22  |  12.5 KB  |  357 lines

  1. //Language: PHP, VB, Java Scripts in XML
  2. //Copyright (c) 1992-2002 Altium Limited             
  3. //All rights reserved.                               
  4. //http://www.dream-com.com                           
  5. //contact@dream-com.com                              
  6.  
  7. // states
  8. State=snormal
  9. State=sstring1
  10. State=sstring2
  11. State=sstring3
  12. State=sstring4
  13. State=sstring5
  14. State=sstring6
  15. State=sstring7
  16. State=scomment1
  17. State=scomment2
  18. State=scomment3
  19. State=scomment4
  20. State=scomment5
  21. State=scomment6
  22. State=scomment7
  23. State=scomment8
  24. State=sXMLtag
  25. State=sXMLphp
  26. State=sXMLvbs
  27. State=sXMLjs
  28. State=sXMLcdata
  29.  
  30. // tokens
  31. Token=tnone
  32. Token=tstring
  33. Token=tcomment
  34. Token=tident
  35. Token=tinteger
  36. Token=tfloat
  37. Token=tresword
  38. Token=tassembler
  39. Token=turl
  40. Token=twhitespace
  41. Token=tresword1
  42. //delims
  43. Delimiters=;.,:'"{}[]()?!@#$%^&*-+=|\/
  44.  
  45. // This is the tag
  46. //------------------------------------------------------------------------------
  47.  
  48. //Common
  49. snormal <             sXMLtag  tresword
  50. sXMLtag [^\>^\"^#32]* sXMLtag  tresword
  51. sXMLtag >             snormal   tresword
  52.  
  53. // numbers
  54. sXMLtag [0-9][0-9]*                            sXMLtag  tinteger
  55. sXMLtag [1-9][0-9]*\.[0-9]*                    sXMLtag  tfloat
  56. sXMLtag [1-9][0-9]*{\.[0-9]+}|e{[\+\-]}|[0-9]+ sXMLtag  tfloat
  57.  
  58.  
  59. //snormal     <                         sXMLtag      tresword
  60. //sXMLtag     [a-z_A-Z][a-z_A-Z0-9]*    sXMLtag      tident
  61. //sXMLtag     >                         snormal      tresword
  62.  
  63.  
  64. // reswords
  65. sXMLtag 'ee'     sXMLtag tresword
  66. sXMLtag 'xsl'    sXMLtag tresword
  67. sXMLtag 'xwl'    sXMLtag tresword
  68.  
  69. sXMLtag 'source' sXMLtag tresword1
  70. sXMLtag 'target' sXMLtag tresword1
  71.  
  72.  
  73.  
  74. //white space
  75. sXMLtag #32*                         sXMLtag   twhitespace
  76.  
  77. //strings
  78. sXMLtag    \"                     sstring1   tstring
  79. sstring1   [^\"]*                 sstring1   tstring
  80. sstring1   \"                     sXMLtag    tstring
  81. sstring1   \"\"                   sstring1   tstring
  82. sstring1   $                      sXMLtag    tstring
  83.  
  84. //comments
  85. sXMLtag    <\!--                    scomment1 tcomment
  86. scomment1  [^\-]*                   scomment1 tcomment
  87. scomment1  -->                      sXMLtag   tcomment
  88.  
  89. //------------------------------------------------------------------------------
  90. // This is the PHP
  91.  
  92. // reswords
  93. sXMLphp 'break'        sXMLphp tresword
  94. sXMLphp 'case'         sXMLphp tresword
  95. sXMLphp 'class'        sXMLphp tresword
  96. sXMLphp 'continue'     sXMLphp tresword
  97. sXMLphp 'default'      sXMLphp tresword
  98. sXMLphp 'do'           sXMLphp tresword
  99. sXMLphp 'else'         sXMLphp tresword
  100. sXMLphp 'elseif'       sXMLphp tresword
  101. sXMLphp 'endfor'       sXMLphp tresword
  102. sXMLphp 'endif'        sXMLphp tresword
  103. sXMLphp 'endswitch'    sXMLphp tresword
  104. sXMLphp 'endwhile'     sXMLphp tresword
  105. sXMLphp 'extends'      sXMLphp tresword
  106. sXMLphp 'for'          sXMLphp tresword
  107. sXMLphp 'function'     sXMLphp tresword
  108. sXMLphp 'global'       sXMLphp tresword
  109. sXMLphp 'if'           sXMLphp tresword
  110. sXMLphp 'int'          sXMLphp tresword
  111. sXMLphp 'old_function' sXMLphp tresword
  112. sXMLphp 'pval'         sXMLphp tresword
  113. sXMLphp 'return'       sXMLphp tresword
  114. sXMLphp 'static'       sXMLphp tresword
  115. sXMLphp 'string'       sXMLphp tresword
  116. sXMLphp 'switch'       sXMLphp tresword
  117. sXMLphp 'var'          sXMLphp tresword
  118. sXMLphp 'void'         sXMLphp tresword
  119. sXMLphp 'while'        sXMLphp tresword
  120.  
  121. // numbers
  122. sXMLphp [0-9][0-9]*                            sXMLphp  tinteger
  123. sXMLphp 0x[0-9A-F]+                            sXMLphp  tinteger
  124. sXMLphp [1-9][0-9]*\.[0-9]*                    sXMLphp  tfloat
  125. sXMLphp [1-9][0-9]*{\.[0-9]+}|e{[\+\-]}|[0-9]+ sXMLphp  tfloat
  126.  
  127. //idents
  128. sXMLphp   [a-z_A-Z][a-z_A-Z0-9]*  sXMLphp   tresword
  129.  
  130. //strings
  131. sXMLphp    \"                     sstring2   tstring
  132. sstring2   [^\"]*                 sstring2   tstring
  133. sstring2   \"                     sXMLphp    tstring
  134. sstring2   \"\"                   sstring2   tstring
  135. sstring2   \\                     sstring2   tstring
  136. sstring2   \\\"                   sstring2   tstring
  137. sstring2   $                      sXMLphp    tstring
  138.  
  139. sXMLphp    \'                     sstring3   tstring
  140. sstring3   [^\']*                 sstring3   tstring
  141. sstring3   \'                     sXMLphp    tstring
  142. sstring3   \'\'                   sstring3   tstring
  143. sstring3   \\                     sstring3   tstring
  144. sstring3   \\\'                   sstring3   tstring
  145. sstring3   $                      sXMLphp    tstring
  146.  
  147. sXMLphp    \`                     sstring4   tstring
  148. sstring4   [^\`]*                 sstring4   tstring
  149. sstring4   \`                     sXMLphp    tstring
  150. sstring4   \`\`                   sstring4   tstring
  151. sstring4   \\                     sstring4   tstring
  152. sstring4   \\\`                   sstring4   tstring
  153. sstring4   $                      sXMLphp    tstring
  154.  
  155. //comments
  156. sXMLphp     //                      scomment2  tcomment
  157. scomment2  [#1-#255]*               sXMLphp    tcomment
  158. scomment2 $                         sXMLphp    tcomment
  159.  
  160. sXMLphp    \#                      scomment3  tcomment
  161. scomment3  [#1-#255]*              sXMLphp    tcomment
  162. scomment3 $                        sXMLphp    tcomment
  163.  
  164. sXMLphp    /\*                     scomment4 tcomment
  165. scomment4  [^\*]*                  scomment4 tcomment
  166. scomment4  \*[^/]                  scomment4 tcomment
  167. scomment4  [\*]*/                  sXMLphp   tcomment
  168.  
  169. snormal        <?php              sXMLphp  tresword
  170. sXMLphp        ?>                 snormal  tresword
  171.  
  172. snormal        <script#32language="php">   sXMLphp  tresword
  173. sXMLphp        </script>                   snormal  tresword
  174. //------------------------------------------------------------------------------
  175. // This is the VBS
  176.  
  177. // reswords
  178. sXMLvbs 'And'        sXMLvbs tresword
  179. sXMLvbs 'As'         sXMLvbs tresword
  180. sXMLvbs 'Attribute'  sXMLvbs tresword
  181. sXMLvbs 'Base'       sXMLvbs tresword
  182. sXMLvbs 'ByVal'      sXMLvbs tresword
  183. sXMLvbs 'Call'       sXMLvbs tresword
  184. sXMLvbs 'Case'       sXMLvbs tresword
  185. sXMLvbs 'Compare'    sXMLvbs tresword
  186. sXMLvbs 'Const'      sXMLvbs tresword
  187. sXMLvbs 'Date'       sXMLvbs tresword
  188. sXMLvbs 'Declare'    sXMLvbs tresword
  189. sXMLvbs 'Dim'        sXMLvbs tresword
  190. sXMLvbs 'Do'         sXMLvbs tresword
  191. sXMLvbs 'Each'       sXMLvbs tresword
  192. sXMLvbs 'Else'       sXMLvbs tresword
  193. sXMLvbs 'Elseif'     sXMLvbs tresword
  194. sXMLvbs 'Empty'      sXMLvbs tresword
  195. sXMLvbs 'end'        sXMLvbs tresword
  196. sXMLvbs 'Error'      sXMLvbs tresword
  197. sXMLvbs 'Exit'       sXMLvbs tresword
  198. sXMLvbs 'Explicit'   sXMLvbs tresword
  199. sXMLvbs 'False'      sXMLvbs tresword
  200. sXMLvbs 'For'        sXMLvbs tresword
  201. sXMLvbs 'friend'     sXMLvbs tresword
  202. sXMLvbs 'Function'   sXMLvbs tresword
  203. sXMLvbs 'get'        sXMLvbs tresword
  204. sXMLvbs 'If'         sXMLvbs tresword
  205. sXMLvbs 'Is'         sXMLvbs tresword
  206. sXMLvbs 'let'        sXMLvbs tresword
  207. sXMLvbs 'Loop'       sXMLvbs tresword
  208. sXMLvbs 'Mod'        sXMLvbs tresword
  209. sXMLvbs 'Next'       sXMLvbs tresword
  210. sXMLvbs 'Not'        sXMLvbs tresword
  211. sXMLvbs 'Nothing'    sXMLvbs tresword
  212. sXMLvbs 'Null'       sXMLvbs tresword
  213. sXMLvbs 'On'         sXMLvbs tresword
  214. sXMLvbs 'Option'     sXMLvbs tresword
  215. sXMLvbs 'Or'         sXMLvbs tresword
  216. sXMLvbs 'Private'    sXMLvbs tresword
  217. sXMLvbs 'property'   sXMLvbs tresword
  218. sXMLvbs 'Public'     sXMLvbs tresword
  219. sXMLvbs 'ReDim'      sXMLvbs tresword
  220. //sXMLvbs 'Rem'        sXMLvbs tresword
  221. sXMLvbs 'Select'     sXMLvbs tresword
  222. sXMLvbs 'Set'        sXMLvbs tresword
  223. sXMLvbs 'String'     sXMLvbs tresword
  224. sXMLvbs 'Sub'        sXMLvbs tresword
  225. sXMLvbs 'Then'       sXMLvbs tresword
  226. sXMLvbs 'To'         sXMLvbs tresword
  227. sXMLvbs 'True'       sXMLvbs tresword
  228. sXMLvbs 'Type'       sXMLvbs tresword
  229. sXMLvbs 'Wend'       sXMLvbs tresword
  230. sXMLvbs 'While'      sXMLvbs tresword
  231. sXMLvbs 'With'       sXMLvbs tresword
  232. sXMLvbs 'Xor'        sXMLvbs tresword
  233.  
  234. //idents
  235. sXMLvbs   [a-z_A-Z][a-z_A-Z0-9]*  sXMLvbs   tident
  236.  
  237. // numbers
  238. sXMLvbs [0-9][0-9]*                            sXMLvbs  tinteger
  239. sXMLvbs [1-9][0-9]*\.[0-9]*                    sXMLvbs  tfloat
  240. sXMLvbs [1-9][0-9]*{\.[0-9]+}|e{[\+\-]}|[0-9]+ sXMLvbs   tfloat
  241.  
  242. //strings
  243. sXMLvbs   \"                     sstring5   tstring
  244. sstring5  [^\"]*                 sstring5   tstring
  245. sstring5  \"                     sXMLvbs    tstring
  246. sstring5  \"\"                   sstring5   tstring
  247. sstring5  $                      sXMLvbs    tstring
  248.  
  249. //comments
  250. sXMLvbs    \'                      scomment5  tcomment
  251. scomment5  [#1-#255]*              sXMLvbs   tcomment
  252. scomment5 $                        sXMLvbs   tcomment
  253.  
  254. sXMLvbs    rem[^#33-#255]          scomment6 tcomment
  255. scomment6  [#1-#255]*              sXMLvbs   tcomment
  256. scomment6  $                       sXMLvbs   tcomment
  257.  
  258. //VBS
  259. snormal     <script#32language="vbscript">   sXMLvbs  tresword
  260. sXMLvbs     </script>                        snormal  tresword
  261.  
  262. snormal     <%                         sXMLvbs  tresword
  263. sXMLvbs     %>                         snormal  tresword
  264. //------------------------------------------------------------------------------
  265. // This is the JS
  266.  
  267. // reswords
  268. sXMLjs 'break'     sXMLjs tresword
  269. sXMLjs 'case'      sXMLjs tresword
  270. sXMLjs 'catch'     sXMLjs tresword
  271. sXMLjs 'class'     sXMLjs tresword
  272. sXMLjs 'const'     sXMLjs tresword
  273. sXMLjs 'continue'  sXMLjs tresword
  274. sXMLjs 'debugger'  sXMLjs tresword
  275. sXMLjs 'default'   sXMLjs tresword
  276. sXMLjs 'delete'    sXMLjs tresword
  277. sXMLjs 'do'        sXMLjs tresword
  278. sXMLjs 'else'      sXMLjs tresword
  279. sXMLjs 'enum'      sXMLjs tresword
  280. sXMLjs 'export'    sXMLjs tresword
  281. sXMLjs 'extends'   sXMLjs tresword
  282. sXMLjs 'false'     sXMLjs tresword
  283. sXMLjs 'finally'   sXMLjs tresword
  284. sXMLjs 'for'       sXMLjs tresword
  285. sXMLjs 'function'  sXMLjs tresword
  286. sXMLjs 'if'        sXMLjs tresword
  287. sXMLjs 'import'    sXMLjs tresword
  288. sXMLjs 'in'        sXMLjs tresword
  289. sXMLjs 'new'       sXMLjs tresword
  290. sXMLjs 'null'      sXMLjs tresword
  291. sXMLjs 'return'    sXMLjs tresword
  292. sXMLjs 'super'     sXMLjs tresword
  293. sXMLjs 'switch'    sXMLjs tresword
  294. sXMLjs 'this'      sXMLjs tresword
  295. sXMLjs 'throw'     sXMLjs tresword
  296. sXMLjs 'true'      sXMLjs tresword
  297. sXMLjs 'try'       sXMLjs tresword
  298. sXMLjs 'typeof'    sXMLjs tresword
  299. sXMLjs 'var'       sXMLjs tresword
  300. sXMLjs 'void'      sXMLjs tresword
  301. sXMLjs 'while'     sXMLjs tresword
  302. sXMLjs 'with'      sXMLjs tresword
  303.  
  304. //idents
  305. sXMLjs   [a-z_A-Z][a-z_A-Z0-9]*  sXMLjs   tident
  306.  
  307. // numbers
  308. sXMLjs [0-9][0-9]*                            sXMLjs  tinteger
  309. sXMLjs 0x[0-9A-F]+                            sXMLjs  tinteger
  310. sXMLjs 0X[0-9A-F]+                            sXMLjs  tinteger
  311. sXMLjs [1-9][0-9]*\.[0-9]*                    sXMLjs  tfloat
  312. sXMLjs [1-9][0-9]*{\.[0-9]+}|e{[\+\-]}|[0-9]+ sXMLjs   tfloat
  313.  
  314. //strings
  315. sXMLjs    \"                     sstring6   tstring
  316. sstring6  [^\"]*                 sstring6   tstring
  317. sstring6  \"                     sXMLjs     tstring
  318. sstring6  \"\"                   sstring6   tstring
  319. sstring6   \\                    sstring6   tstring
  320. sstring6   \\\"                  sstring6   tstring
  321. sstring6  $                      sXMLjs     tstring
  322.  
  323. sXMLjs    \'                     sstring7   tstring
  324. sstring7  [^\']*                 sstring7   tstring
  325. sstring7  \'                     sXMLjs     tstring
  326. sstring7  \'\'                   sstring7   tstring
  327. sstring7   \\                    sstring7   tstring
  328. sstring7   \\\'                  sstring7   tstring
  329. sstring7  $                      sXMLjs     tstring
  330.  
  331. //comments
  332. sXMLjs     //                      scomment7  tcomment
  333. scomment7  [#1-#255]*             sXMLjs     tcomment
  334. scomment7 $                       sXMLjs     tcomment
  335.  
  336. sXMLjs    /\*                     scomment8  tcomment
  337. scomment8 [^\*]*                  scomment8  tcomment
  338. scomment8 \*[^/]                  scomment8  tcomment
  339. scomment8 [\*]*/                  sXMLjs     tcomment
  340.  
  341. //JS
  342. snormal     <script#32language="jscript">    sXMLjs   tresword
  343. sXMLjs      </script>                        snormal  tresword
  344.  
  345. snormal     <script#32language="javascript"> sXMLjs   tresword
  346. sXMLjs      </script>                        snormal  tresword
  347. //------------------------------------------------------------------------------
  348. // This is the CDATA
  349.  
  350. //idents
  351. sXMLcdata   [a-z_A-Z][a-z_A-Z0-9]*  sXMLcdata   tident
  352.  
  353. //CDATA
  354. snormal        <\!\[CDATA\[                  sXMLcdata   tresword
  355. sXMLcdata      \]\]>                         snormal     tresword
  356. //------------------------------------------------------------------------------
  357.